<template>
  <div>
  <a-table :columns="columns" :data-source="data" :rowKey="(record,index)=>{return index}"  bordered>
    <template slot="name" slot-scope="text">
      <a href="javascript:;">{{text}}</a>

    </template>
<!--    <template slot="title" slot-scope="currentPageData">-->
<!--      Header&#45;&#45;{{currentPageData}}　　　　-->
<!--    </template>-->
    <template slot="footer">
      操作管理&nbsp;: &nbsp;&nbsp;
      <a-button type="primary"><router-link to="/user/add_user">增加 / 注册</router-link></a-button> &emsp;
      <a-button type="danger"><router-link to="/user/del_user">删除</router-link></a-button> &emsp;
      <a-button><router-link to="/user/update_user">修改</router-link></a-button> &emsp;
      <a-button type="dashed"><router-link to="/user/find_user">查找</router-link></a-button> &emsp;
      <br><br> <p style="color: red">ps:此时的修改是根据用户ID进行修改</p>
      <router-view></router-view>
    </template>　　// 跟上同理
  </a-table>
  </div>
</template>

<script>
const columns = [
  // {
  //   title: '用户ID',
  //   dataIndex: 'id',
  //   key: 'id',
  // },
  {
    title: '用户名',
    dataIndex: 'username',
    // key: 'username',
  },
  {
    title: '等级',
    dataIndex: 'user_level',
    // key: 'username',
  },
  // {
  //   title: '详情',
  //   // dataIndex: 'password',
  //   // key: 'password',
  // },
];

export default {
name: "user",
  data() {
    return {
      collapsed: false,
      data:[],
      columns,
    }
  },
  created() {
    this.getUser()
  },
  methods:{
    getUser(){
      this.$axios.get('z/user/')
        .then(res=>{
          this.data=res.data.data
        })
    }
  },
}
</script>

<style scoped>

</style>
